<?php

namespace app\admin\controller;

use think\Controller;

class LoginController extends Controller
{
    protected function initialize()
    {
        parent::initialize();
        $this->server = model('server.admin');
    }

    public function loginOp()
    {
        $postData = validateRequestParam('admin', 'login');
        $responseData['meta'] = ['code' => 1, 'msg' => lang('LOGIN_SUCCESS')];
        $responseData['data'] = $this->server->login($postData);

        return $responseData;
    }

    public function getLeftMenuOp()
    {
        $responseData['meta'] = ['code' => 1, 'msg' => lang('GET_SUCCESS')];
        $responseData['data'] = model('server.menu')->getLeftMenu();

        return $responseData;
    }

    public function getRouterMenuOp()
    {
        $responseData['meta'] = ['code' => 1, 'msg' => lang('GET_SUCCESS')];
        $responseData['data'] = model('server.menu')->getRouterMenu();

        return $responseData;
    }
}
